<template>
  <div class="page-container">
    <div class="page-header">
      <div class="page-tile">
        {{ $t('route.systemSettings') }}
        <i v-if="false" class="iconfont iconzhongyiicon_gaojing"></i>
      </div>
      <div class="left-wrapper"></div>
      <div class="right-wrapper"></div>
    </div>
    <el-scrollbar class="page-content">
      <div class="content-wrapper">
        <el-card>
          <el-tabs value="resource_pool">
            <!-- 资源池 START -->
            <el-tab-pane :label="$t('systemSettings.resourcePool')" name="resource_pool">
              <div class="action-wrapper">
                <el-button v-if="!resourcePoolOptionEditable" :disabled="resourcePoolLoading" @click="resourcePoolOptionEditable = true" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="resourcePoolOptionEditable" type="primary" :disabled="resourcePoolLoading" @click="save({ loadResourcePoolData: true, loadOrinusData: true })" class="icon-button setting-button" style="width: auto;" >
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="resourcePoolOptionEditable" :disabled="resourcePoolLoading" @click="cancel({ loadResourcePoolData: true, loadOrinusData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="resourcePoolOptionForm" label-width="180" :model="resourcePoolOptionData" :rules="resourcePoolOptionRules" v-loading="resourcePoolLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.sync_resource_polling_interval') + $t('common.unitSecond')" prop="sync_resource_polling_interval" class="option-container">
                  <span v-if="!resourcePoolOptionEditable">{{ resourcePoolOptionData.sync_resource_polling_interval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="resourcePoolOptionEditable" v-model="resourcePoolOptionData.sync_resource_polling_interval" @input="(value) => resourcePoolOptionData.sync_resource_polling_interval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.horizon_resource_count_polling_interval') + $t('common.unitSecond')" prop="horizon_resource_count_polling_interval" class="option-container">
                  <span v-if="!resourcePoolOptionEditable">{{ orinusOptionData.horizon_resource_count_polling_interval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="resourcePoolOptionEditable" v-model="orinusOptionData.horizon_resource_count_polling_interval" @input="(value) => orinusOptionData.horizon_resource_count_polling_interval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('resource.mobile')" prop="global_desktop_exceptions_notice_mobiles" class="option-container">
                  <p style="word-break: break-all;" v-if="!resourcePoolOptionEditable">{{ (resourcePoolOptionData.global_desktop_exceptions_notice_mobiles) }}</p>
                  <el-input style="width:500px;" :autosize="{ minRows: 2}" type=textarea v-if="resourcePoolOptionEditable" v-model="resourcePoolOptionData.global_desktop_exceptions_notice_mobiles" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('resource.email')" prop="global_desktop_exceptions_notice_mails" class="option-container">
                  <p style="word-break: break-all;" v-if="!resourcePoolOptionEditable">{{ (resourcePoolOptionData.global_desktop_exceptions_notice_mails) }}</p>
                  <el-input style="width:500px;" :autosize="{ minRows: 2}" type=textarea v-if="resourcePoolOptionEditable" v-model="resourcePoolOptionData.global_desktop_exceptions_notice_mails" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
              </el-form>
            </el-tab-pane>
            <!-- 资源池 END -->

            <!-- 桌面 START -->
            <el-tab-pane :label="$t('systemSettings.desktop')" name="desktop">
              <div class="action-wrapper">
                <el-button v-if="!desktopOptionEditable" :disabled="desktopLoading" @click="desktopOptionEditable = true" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="desktopOptionEditable" :disabled="desktopLoading" type="primary" @click="save({ loadDesktopData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="desktopOptionEditable" :disabled="desktopLoading" @click="cancel({ loadDesktopData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="desktopOptionForm" :model="desktopOptionData" :rules="desktopOptionRules" :disabled="desktopLoading" v-loading="desktopLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.timeout_of_desktop_status') + $t('common.unitSecond')" prop="timeout_of_desktop_status" class="option-container">
                  <span v-if="!desktopOptionEditable">{{ desktopOptionData.timeout_of_desktop_status }}</span>
                  <el-input type="number" class="number" :min="0" v-if="desktopOptionEditable" v-model="desktopOptionData.timeout_of_desktop_status" @input="(value) => desktopOptionData.timeout_of_desktop_status = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <!-- <el-form-item :label="$t('systemSettings.horizonDesktopStatusCheckTimeOut') + $t('common.unitSecond')" prop="horizonDesktopStatusCheckTimeOut" class="option-container">
                  <span v-if="!desktopOptionEditable">{{ desktopOptionData.horizonDesktopStatusCheckTimeOut }}</span>
                  <el-input type="number" class="number" :min="0" v-if="desktopOptionEditable" v-model="desktopOptionData.horizonDesktopStatusCheckTimeOut" @input="(value) => desktopOptionData.horizonDesktopStatusCheckTimeOut = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.daasDesktopStatusPollingInterval') + $t('common.unitSecond')" prop="daasDesktopStatusPollingInterval" class="option-container">
                  <span v-if="!desktopOptionEditable">{{ desktopOptionData.daasDesktopStatusPollingInterval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="desktopOptionEditable" v-model="desktopOptionData.daasDesktopStatusPollingInterval" @input="(value) => desktopOptionData.daasDesktopStatusPollingInterval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.daasDesktopStatusCheckTimeOut') + $t('common.unitSecond')" prop="daasDesktopStatusCheckTimeOut" class="option-container">
                  <span v-if="!desktopOptionEditable">{{ desktopOptionData.daasDesktopStatusCheckTimeOut }}</span>
                  <el-input type="number" class="number" :min="0" v-if="desktopOptionEditable" v-model="desktopOptionData.daasDesktopStatusCheckTimeOut" @input="(value) => desktopOptionData.daasDesktopStatusCheckTimeOut = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item> -->
              </el-form>
            </el-tab-pane>
            <!-- 桌面 END -->

            <!-- 会话 START -->
            <el-tab-pane :label="$t('systemSettings.session')" name="session">
              <div class="action-wrapper">
                <el-button v-if="!sessionOptionEditable" :disabled="sessionLoading" @click="sessionOptionEditable = true" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="sessionOptionEditable" type="primary" :disabled="sessionLoading" @click="save({ loadSessionData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="sessionOptionEditable" :disabled="sessionLoading" @click="cancel({ loadSessionData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="sessionOptionForm" :model="sessionOptionData" :rules="sessionOptionRules" v-loading="sessionLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.desktop_session_polling_interval') + $t('common.unitSecond')" prop="desktop_session_polling_interval" class="option-container">
                  <span v-if="!sessionOptionEditable">{{ sessionOptionData.desktop_session_polling_interval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="sessionOptionEditable" v-model="sessionOptionData.desktop_session_polling_interval" @input="(value) => sessionOptionData.desktop_session_polling_interval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktopSessionReportInterval') + $t('common.unitSecond')" prop="desktop_heartbeat_interval" class="option-container">
                  <span v-if="!sessionOptionEditable">{{ sessionOptionData.desktop_heartbeat_interval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="sessionOptionEditable" v-model="sessionOptionData.desktop_heartbeat_interval" @input="(value) => sessionOptionData.desktop_heartbeat_interval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktop_session_timeout') + $t('common.unitSecond')" prop="desktop_session_timeout" class="option-container">
                  <span v-if="!sessionOptionEditable">{{ sessionOptionData.desktop_session_timeout }}</span>
                  <el-input type="number" class="number" :min="0" v-if="sessionOptionEditable" v-model="sessionOptionData.desktop_session_timeout" @input="(value) => sessionOptionData.desktop_session_timeout = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
              </el-form>
            </el-tab-pane>
            <!-- 会话 END -->

            <!-- 告警 START -->
            <!-- <el-tab-pane :label="$t('systemSettings.alert')" name="alert">
              <div class="action-wrapper">
                <el-button v-if="!alertOptionEditable" :disabled="alertLoading" @click="alertOptionEditable = true" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="alertOptionEditable" type="primary" @click="save({ loadAlertData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="alertOptionEditable" :disabled="alertLoading" @click="cancel({ loadAlertData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="alertOptionForm" :model="alertOptionData" :rules="alertOptionRules" v-loading="alertLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.manageServerCheckInterval') + $t('common.unitSecond')" prop="manageServerCheckInterval" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.manageServerCheckInterval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.manageServerCheckInterval" @input="(value) => alertOptionData.manageServerCheckInterval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.manageServerCheckTimeout') + $t('common.unitSecond')" prop="manageServerCheckTimeout" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.manageServerCheckTimeout }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.manageServerCheckTimeout" @input="(value) => alertOptionData.manageServerCheckTimeout = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.ADCheckInterval') + $t('common.unitSecond')" prop="ADCheckInterval" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.ADCheckInterval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.ADCheckInterval" @input="(value) => alertOptionData.ADCheckInterval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.ADCheckTimeout') + $t('common.unitSecond')" prop="ADCheckTimeout" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.ADCheckTimeout }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.ADCheckTimeout" @input="(value) => alertOptionData.ADCheckTimeout = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktopGatewayCheckInterval') + $t('common.unitSecond')" prop="desktopGatewayCheckInterval" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.desktopGatewayCheckInterval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.desktopGatewayCheckInterval" @input="(value) => alertOptionData.desktopGatewayCheckInterval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktopGatewayCheckTimeout') + $t('common.unitSecond')" prop="desktopGatewayCheckTimeout" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.desktopGatewayCheckTimeout }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.desktopGatewayCheckTimeout" @input="(value) => alertOptionData.desktopGatewayCheckTimeout = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktopNetworkCheckInterval') + $t('common.unitSecond')" prop="desktopNetworkCheckInterval" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.desktopNetworkCheckInterval }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.desktopNetworkCheckInterval" @input="(value) => alertOptionData.desktopNetworkCheckInterval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktopNetworkCheckTimeout') + $t('common.unitSecond')" prop="desktopNetworkCheckTimeout" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.desktopNetworkCheckTimeout }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.desktopNetworkCheckTimeout" @input="(value) => alertOptionData.desktopNetworkCheckTimeout = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.alertManagerList')" prop="alertManagerList" class="option-container">
                  <span v-if="!alertOptionEditable">{{ alertOptionData.alertManagerList }}</span>
                  <el-input type="number" class="number" :min="0" v-if="alertOptionEditable" v-model="alertOptionData.alertManagerList" @input="(value) => alertOptionData.alertManagerList = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
              </el-form>
            </el-tab-pane> -->
            <!-- 告警 END -->

            <!-- 用户 START -->
            <el-tab-pane :label="$t('systemSettings.user')" name="user">
              <div class="action-wrapper">
                <el-button v-if="!userOptionEditable" :disabled="userLoading" @click="userOptionEditable = true" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="userOptionEditable" type="primary" :disabled="userLoading" @click="save({ loadUserData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="userOptionEditable" :disabled="userLoading" @click="cancel({ loadUserData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="userOptionForm" :model="userOptionData" :rules="userOptionRules" v-loading="userLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.auth_failed_max_times')" prop="auth_failed_max_times" class="option-container">
                  <span v-if="!userOptionEditable">{{ userOptionData.auth_failed_max_times }}</span>
                  <el-input type="number" class="number" :min="0" v-if="userOptionEditable" v-model="userOptionData.auth_failed_max_times" @input="(value) => userOptionData.auth_failed_max_times = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.auth_failed_try_later') + $t('common.unitSecond')" prop="auth_failed_try_later" class="option-container">
                  <span v-if="!userOptionEditable">{{ userOptionData.auth_failed_try_later }}</span>
                  <el-input type="number" class="number" :min="0" v-if="userOptionEditable" v-model="userOptionData.auth_failed_try_later" @input="(value) => userOptionData.auth_failed_try_later = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.enable_complex_password')" prop="enable_complex_password" class="option-container">
                  <!-- <el-input type="number" class="number" :min="0" v-if="userOptionEditable" v-model="userOptionData.enable_complex_password" @input="(value) => userOptionData.enable_complex_password = parseInt(value)" @keyup.enter.native="saveAll"></el-input> -->
                  <el-switch
                    :class="language === 'zh' ? '' :'el-switch-en'"
                    :disabled="!userOptionEditable"
                    v-model="userOptionData.enable_complex_password">
                  </el-switch>
                </el-form-item>
              </el-form>
            </el-tab-pane>
            <!-- 用户 END -->

            <!-- 终端 START -->
            <el-tab-pane :label="$t('systemSettings.client')" name="client">
              <div class="action-wrapper">
                <el-button v-if="!clientOptionEditable" :disabled="clientLoading" class="icon-button setting-button" style="width: auto;" @click="clientOptionEditable = true">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="clientOptionEditable" type="primary" :disabled="clientLoading" class="icon-button setting-button" style="width: auto;" @click="save({ loadClientData: true })">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="clientOptionEditable" :disabled="clientLoading" class="icon-button setting-button" style="width: auto;" @click="cancel({ loadClientData: true })">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="clientOptionForm" :model="clientOptionData" :rules="clientOptionRules" v-loading="clientLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.desktop_client_console_password')" prop="desktop_client_console_password" class="option-container">
                  <span v-if="!clientOptionEditable">{{ getPasswordHidden(clientOptionData.desktop_client_console_password) }}</span>
                  <el-input type="password" show-password v-if="clientOptionEditable" v-model="clientOptionData.desktop_client_console_password" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.max_binding_client_num')" prop="max_binding_client_num" class="option-container">
                  <span v-if="!clientOptionEditable">{{ clientOptionData.max_binding_client_num }}</span>
                  <el-input class="number" type="number" :min="0" :max="5" @input="(value) => clientOptionData.max_binding_client_num = parseInt(value)" v-if="clientOptionEditable" v-model="clientOptionData.max_binding_client_num" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.faqUrl')" prop="faq_url" class="option-container">
                  <span v-if="!clientOptionEditable && clientOptionData.faq_url.length <= 50">{{ clientOptionData.faq_url }}</span>
                  <el-popover
                    v-if="!clientOptionEditable && clientOptionData.faq_url.length > 50"
                    placement="top-start"
                    width="300"
                    trigger="hover"
                    >
                    <p>{{clientOptionData.faq_url}}</p>
                    <el-link :underline="false" slot="reference" type="primary" style="font-size:12px">{{delContext(clientOptionData.faq_url)}}</el-link>
                  </el-popover>
                  <el-input v-if="clientOptionEditable" v-model="clientOptionData.faq_url" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.logExtractionMinutes')" prop="log_extraction_interval" class="option-container">
                  <span v-if="!clientOptionEditable">{{ clientOptionData.log_extraction_interval }}</span>
                  <el-input class="number" type="number" :min="0" :max="24" @input="(value) => clientOptionData.log_extraction_interval = parseInt(value)" v-if="clientOptionEditable" v-model="clientOptionData.log_extraction_interval" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.logExtractionTimes')" prop="log_extraction_times" class="option-container">
                  <span v-if="!clientOptionEditable">{{ clientOptionData.log_extraction_times }}</span>
                  <el-input class="number" type="number" :min="0" :max="24" @input="(value) => clientOptionData.log_extraction_times = parseInt(value)" v-if="clientOptionEditable" v-model="clientOptionData.log_extraction_times" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
              </el-form>
            </el-tab-pane>
            <!-- 终端 END -->

            <!-- 系统 START -->
            <el-tab-pane :label="$t('systemSettings.system')" name="system">
              <div class="action-wrapper">
                <el-button v-if="!systemOptionEditable" :disabled="systemLoading" class="icon-button setting-button" style="width: auto;" @click="systemOptionEditable = true">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="systemOptionEditable" type="primary" :disabled="systemLoading" class="icon-button setting-button" style="width: auto;" @click="save({ loadSystemData: true })">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="systemOptionEditable" :disabled="systemLoading" class="icon-button setting-button" style="width: auto;" @click="cancel({ loadSystemData: true })">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="systemOptionForm" :model="systemOptionData" :rules="systemOptionRules" v-loading="systemLoading" class="options-list-container">
                <!-- <el-form-item :label="$t('systemSettings.dbBackupPosition')" prop="dbBackupPosition" class="option-container">
                  <span v-if="!systemOptionEditable">{{ systemOptionData.dbBackupPosition }}</span>
                  <el-input type="number" class="number" :min="0" v-if="systemOptionEditable" v-model="systemOptionData.dbBackupPosition" @input="(value) => systemOptionData.dbBackupPosition = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.dbBackupRetentionCount')" prop="dbBackupRetentionCount" class="option-container">
                  <span v-if="!systemOptionEditable">{{ systemOptionData.dbBackupRetentionCount }}</span>
                  <el-input type="number" class="number" :min="0" v-if="systemOptionEditable" v-model="systemOptionData.dbBackupRetentionCount" @input="(value) => systemOptionData.dbBackupRetentionCount = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item> -->
                <el-form-item :label="$t('systemSettings.ntp_server_ip_addr')" prop="ntp_server_ip_addr" class="option-container">
                  <span v-if="!systemOptionEditable">{{ systemOptionData.ntp_server_ip_addr }}</span>
                  <el-input v-if="systemOptionEditable" v-model="systemOptionData.ntp_server_ip_addr" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
              </el-form>
            </el-tab-pane>
            <!-- 系统 END -->

            <!-- 订单 START -->
            <el-tab-pane :label="$t('systemSettings.order')" name="orinus">
              <div class="action-wrapper">
                <el-button v-if="!orinusOptionEditable" :disabled="orinusLoading" class="icon-button setting-button" style="width: auto;" @click="orinusOptionEditable = true">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="orinusOptionEditable" type="primary" :disabled="orinusLoading" class="icon-button setting-button" style="width: auto;" @click="save({ loadOrinusData: true })">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="orinusOptionEditable" :disabled="orinusLoading" class="icon-button setting-button" style="width: auto;" @click="cancel({ loadOrinusData: true })">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="orinusOptionForm" :model="orinusOptionData" :rules="orinusOptionRules" v-loading="orinusLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.desktop_order_check_polling_interval') + $t('common.unitSecond')" prop="desktop_order_check_polling_interval" class="option-container">
                  <span v-if="!orinusOptionEditable">{{ orinusOptionData.desktop_order_check_polling_interval }}</span>
                  <el-input v-if="orinusOptionEditable" type="number" class="number" :min="0" v-model="orinusOptionData.desktop_order_check_polling_interval" @input="(value) => orinusOptionData.desktop_order_check_polling_interval = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktop_order_handling_timeout') + $t('common.unitMinutes')" prop="desktop_order_handling_timeout" class="option-container">
                  <span v-if="!orinusOptionEditable">{{ orinusOptionData.desktop_order_handling_timeout }}</span>
                  <el-input v-if="orinusOptionEditable" type="number" class="number" :min="1" v-model="orinusOptionData.desktop_order_handling_timeout" @input="(value) => orinusOptionData.desktop_order_handling_timeout = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.desktop_order_handling_dead_timeout') + $t('common.unitMinutes')" prop="desktop_order_handling_dead_timeout" class="option-container">
                  <span v-if="!orinusOptionEditable">{{ orinusOptionData.desktop_order_handling_dead_timeout }}</span>
                  <el-input v-if="orinusOptionEditable" type="number" class="number" :min="0" v-model="orinusOptionData.desktop_order_handling_dead_timeout" @input="(value) => orinusOptionData.desktop_order_handling_dead_timeout = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
              </el-form>
            </el-tab-pane>
            <!-- 订单 END -->

            <!-- 日志 START -->
            <el-tab-pane :label="$t('systemSettings.log')" name="log">
              <div class="action-wrapper">
                <el-button v-if="!logOptionEditable" :disabled="logLoading" class="icon-button setting-button" style="width: auto;" @click="logOptionEditable = true">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="logOptionEditable" type="primary" :disabled="logLoading" @click="save({ loadLogData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="logOptionEditable" :disabled="logLoading" @click="cancel({ loadLogData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="logOptionForm" :model="logOptionData" :rules="logOptionRules" v-loading="logLoading" class="options-list-container">
                <el-form-item :label="$t('systemSettings.logRetentionDays') + $t('common.unitDay')" prop="logRetentionDays" class="option-container">
                  <span v-if="!logOptionEditable">{{ logOptionData.logRetentionDays }}</span>
                  <el-input type="number" class="number" :min="1" :max="365" v-if="logOptionEditable" v-model="logOptionData.logRetentionDays" @input="(value) => logOptionData.logRetentionDays = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <!-- <el-form-item :label="$t('systemSettings.logBackupCycle') + $t('common.unitDay')" prop="logBackupCycle" class="option-container">
                  <span v-if="!logOptionEditable">{{ logOptionData.logBackupCycle }}</span>
                  <el-input type="number" class="number" :min="1" :max="365" v-if="logOptionEditable" v-model="logOptionData.logBackupCycle" @input="(value) => logOptionData.logBackupCycle = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <el-form-item :label="$t('systemSettings.logBackupRetentionDays') + $t('common.unitDay')" prop="logBackupRetentionDays" class="option-container">
                  <span v-if="!logOptionEditable">{{ logOptionData.logBackupRetentionDays }}</span>
                  <el-input type="number" class="number" :min="1" :max="365" v-if="logOptionEditable" v-model="logOptionData.logBackupRetentionDays" @input="(value) => logOptionData.logBackupRetentionDays = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item> -->
              </el-form>
            </el-tab-pane>
            <!-- 日志 END -->
            <!-- 工作区 START -->
            <el-tab-pane :label="$t('workspace.workSpace')" name="workspace">
              <div class="action-wrapper">
                <el-button v-if="!workSpaceOptionEditable" :disabled="workSpaceLoading" class="icon-button setting-button" style="width: auto;" @click="workSpaceOptionEditable = true">
                  <i class="el-icon-edit" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.edit')}}</span>
                </el-button>
                <el-button v-if="workSpaceOptionEditable" type="primary" :disabled="workSpaceLoading" @click="save({ loadWorkSpaceData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-check" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.save')}}</span>
                </el-button>
                <el-button v-if="workSpaceOptionEditable" :disabled="workSpaceLoading" @click="cancel({ loadWorkSpaceData: true })" class="icon-button setting-button" style="width: auto;">
                  <i class="el-icon-close" style="font-size: 12px; margin-right: 5px;"></i>
                  <span style="font-size: 12px;">{{$t('common.cancel')}}</span>
                </el-button>
              </div>
              <el-form ref="workSpaceOptionForm" :model="workSpaceData" :rules="workSpaceRules" v-loading="workSpaceLoading" class="options-list-container">
                <el-form-item :label="$t('workspace.horizonDaaSWorkspaceDefault')" prop="horizonDaaSWorkspaceDefault" class="option-container">
                  <span v-if="!workSpaceOptionEditable">{{ workSpaceData.horizonDaaSWorkspaceDefault }}</span>
                  <el-input type="number" class="number" :min="1" :max="2000" v-if="workSpaceOptionEditable" v-model="workSpaceData.horizonDaaSWorkspaceDefault" @input="(value) => workSpaceData.horizonDaaSWorkspaceDefault = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item>
                <!-- <el-form-item :label="$t('workspace.horizonEdgeWorkspaceMax')" prop="horizonEdgeWorkspaceMax" class="option-container">
                  <span v-if="!workSpaceOptionEditable">{{ workSpaceData.horizonEdgeWorkspaceMax }}</span>
                  <el-input type="number" class="number" :min="1" :max="500" v-if="workSpaceOptionEditable" v-model="workSpaceData.horizonEdgeWorkspaceMax" @input="(value) => workSpaceData.horizonEdgeWorkspaceMax = parseInt(value)" @keyup.enter.native="saveAll" :title="''"></el-input>
                </el-form-item> -->
                <el-form-item :label="$t('workspace.horizonEdgrWorkspaceDefault')" prop="horizonEdgrWorkspaceDefault" class="option-container">
                  <span v-if="!workSpaceOptionEditable">{{ workSpaceData.horizonEdgrWorkspaceDefault }}</span>
                  <el-input type="number" class="number" :min="1" :max="200" v-if="workSpaceOptionEditable" v-model="workSpaceData.horizonEdgrWorkspaceDefault" @input="(value) => workSpaceData.horizonEdgrWorkspaceDefault = parseInt(value)" @keyup.enter.native="saveAll" :title="''"></el-input>
                </el-form-item>
                <!-- <el-form-item :label="$t('workspace.horizonEdgeSubstWorkspace')" prop="horizonEdgeSubstWorkspace" class="option-container">
                  <span v-if="!workSpaceOptionEditable">{{ workSpaceData.horizonEdgeSubstWorkspace }}</span>
                  <el-input type="number" class="number" :min="1" :max="500" v-if="workSpaceOptionEditable" v-model="workSpaceData.horizonEdgeSubstWorkspace" @input="(value) => workSpaceData.horizonEdgeSubstWorkspace = parseInt(value)" @keyup.enter.native="saveAll"></el-input>
                </el-form-item> -->
              </el-form>
            </el-tab-pane>
            <!-- 工作区 END -->
          </el-tabs>
        </el-card>
      </div>
    </el-scrollbar>
  </div>
</template>
<script lang="ts">
import Vue from 'vue'
import BasicTable from '../../components/Basic/Table/BasicTable.vue';
import LinkButton from '../../components/Basic/Button/LinkButton.vue';
import { isValidURL, isValidNetAddress } from '../../utils/validate';
import { AppModule } from '@/store/modules/app';
import { encrypt,decodeToken } from '@/utils/auth';
import { decrypt } from '../../utils/auth';
import { deepClone } from '../../utils';
export default Vue.extend({
  components: {
    BasicTable,
    LinkButton
  },
  data() {
    let validateUrl = (rule: any, value: any, callback: any) => {
      if (!isValidURL(value)) {
        callback(new Error(this.$t("systemSetting.clientAddress") as string))
      }else{
        callback()
      }
    };
    return {
      language: AppModule.language,
      systemAdminList: [],
      messagePromise: Promise.resolve(),
      resourcePoolOptionEditable: false, // 资源池部分可编辑
      resourcePoolLoading: false, // 资源池加载
      desktopOptionEditable: false, // 桌面部分可编辑
      desktopLoading: false, // 桌面加载
      sessionOptionEditable: false, // 会话部分可编辑
      sessionLoading: false, // 会话加载
      alertOptionEditable: false, // 告警部分可编辑
      alertLoading: false, // 告警加载
      logOptionEditable: false, // 日志部分可编辑
      logLoading: false, // 日志加载
      userOptionEditable: false, // 用户部分可编辑
      userLoading: false, // 用户加载
      systemOptionEditable: false, // 系统部分可编辑
      clientLoading: false, // 终端加载
      clientOptionEditable: false, // 终端部分可编辑
      systemLoading: false, // 系统加载
      orinusLoading: false, // 订单加载
      orinusOptionEditable: false, // 订单部分可编辑
      workSpaceOptionEditable: false, // 工作区部分可编辑
      workSpaceLoading: false, //工作区加载
      /**
       * 资源池表单数据
       */
      resourcePoolOptionData: {
        sync_resource_polling_interval: 30, // 资源自动同步周期
        global_desktop_exceptions_notice_mobiles: "", // 管理员手机号
        global_desktop_exceptions_notice_mails: "", //管理员邮箱
      },
      /**
       * 资源池表单验证规则
       */
      resourcePoolOptionRules: {
        sync_resource_polling_interval: [
          { required: true, message: '请输入旗舰&GPU版租户自动同步周期，单位分钟', trigger: 'blur' },
          { type: 'number', min: 3600, max: 18000, message: this.$t("systemSetting.syncResource"), trigger: 'blur' }
        ],
        global_desktop_exceptions_notice_mobiles: [
          { validator: (rule: any, value: any, callback: any) => {
            if(value == "") {
              return callback();
            }
            const exp = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/;
            const d = value.split(',')
            for(let i in d) {
              if(!exp.test(d[i])) {
                return callback((this as any).$t("resource.checkMobileTips"))
              }
            }
            return callback();
          }, trigger: 'blur' },
        ],
        global_desktop_exceptions_notice_mails: [
          { validator: (rule: any, value: any, callback: any) => {
            if(value == "") {
              return callback();
            }
            const exp = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
            const d = value.split(',')
            for(let i in d) {
              if(!exp.test(d[i])) {
                return callback((this as any).$t("resource.checkEmailTips"))
              }
            }
            return callback();
          }, trigger: 'blur' },
        ],
      },
      /**
       * 桌面表单数据
       */
      desktopOptionData: {
        timeout_of_desktop_status: 30, // Horizon桌面状态轮询间隔
        horizonDesktopStatusCheckTimeOut: 30, // Horizon桌面状态检测超时
        daasDesktopStatusPollingInterval: 30, // Daas桌面状态轮询间隔
        daasDesktopStatusCheckTimeOut: 30 // Daas桌面状态检测超时
      },
      /**
       * 桌面表单验证规则
       */
      desktopOptionRules: {
        timeout_of_desktop_status: [
          { required: true, message: '请输入Horizon桌面状态轮询间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: this.$t('systemSetting.desktopStatus'), trigger: 'blur' }
        ],
        horizonDesktopStatusCheckTimeOut: [
          { required: true, message: '请输入Horizon桌面状态检测超时，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: 'Horizon桌面状态检测超时范围为0-1000000', trigger: 'blur' }
        ],
        daasDesktopStatusPollingInterval: [
          { required: true, message: '请输入Daas桌面状态轮询间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: 'Daas桌面状态轮询间隔为0-1000000', trigger: 'blur' }
        ],
        daasDesktopStatusCheckTimeOut: [
          { required: true, message: '请输入Daas桌面状态检测超时，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: 'Daas桌面状态检测超时为0-1000000', trigger: 'blur' }
        ]
      },
      /**
       * 会话表单数据
       */
      sessionOptionData: {
        desktop_session_polling_interval: 30, // 桌面会话检测间隔
        desktop_heartbeat_interval: 60, // 桌面会话上报间隔
        desktop_session_timeout: 300 // 桌面会话丢失超时
      },
      /**
       * 会话表单规则
       */
      sessionOptionRules: {
        desktop_session_polling_interval: [
          { required: true, message: '请输入桌面会话检测间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: this.$t('systemSetting.desktopSessionCheck'), trigger: 'blur' }
        ],
        desktop_heartbeat_interval: [
          { required: true, message: '请输入桌面会话上报间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: this.$t('systemSetting.desktopSessionheart'), trigger: 'blur' }
        ],
        desktop_session_timeout: [
          { required: true, message: '请输入桌面会话丢失超时，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: this.$t('systemSetting.desktopSessionLose'), trigger: 'blur' }
        ]
      },
      /**
       * 告警表单数据
       */
      alertOptionData: {
        manageServerCheckInterval: 30, // 管理服务器检测间隔
        manageServerCheckTimeout: 30, // 管理服务器检测超时
        ADCheckInterval: 30, // AD域检测间隔
        ADCheckTimeout: 30, // AD域检测超时
        desktopGatewayCheckInterval: 30, // 桌面网关检测间隔
        desktopGatewayCheckTimeout: 30, // 桌面网关检测超时
        desktopNetworkCheckInterval: 30, // 桌面网络检测间隔
        desktopNetworkCheckTimeout: 30, // 桌面网络检测超时
        alertManagerList: 30 // 接受告警的系统管理员列表
      },
      /**
       * 告警表单数据
       */
      alertOptionRules: {
        manageServerCheckInterval: [
          { required: true, message: '请输入管理服务器检测间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: '管理服务器检测间隔范围为0-1000000', trigger: 'blur' }
        ],
        manageServerCheckTimeout: [
          { required: true, message: '请输入管理服务器检测超时，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: '管理服务器检测超时范围为0-1000000', trigger: 'blur' }
        ],
        ADCheckInterval: [
          { required: true, message: '请输入AD域检测间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: 'AD域检测间隔范围为0-1000000', trigger: 'blur' }
        ],
        ADCheckTimeout: [
          { required: true, message: '请输入AD域检测超时，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: 'AD域检测超时范围为0-1000000', trigger: 'blur' }
        ],
        desktopGatewayCheckInterval: [
          { required: true, message: '请输入桌面网关检测间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: '桌面网关检测间隔范围为0-1000000', trigger: 'blur' }
        ],
        desktopGatewayCheckTimeout: [
          { required: true, message: '请输入桌面网关检测超时，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: '桌面网关检测超时范围为0-1000000', trigger: 'blur' }
        ],
        desktopNetworkCheckInterval: [
          { required: true, message: '请输入桌面网络检测间隔，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: '桌面网络检测间隔范围为0-1000000', trigger: 'blur' }
        ],
        desktopNetworkCheckTimeout: [
          { required: true, message: '请输入桌面网络检测超时，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: '桌面网络检测超时范围为0-1000000', trigger: 'blur' }
        ],
        alertManagerList: [
          { required: true, message: '至少选择一个接收告警的系统管理员', trigger: 'blur' }
        ]
      },
      /**
       * 日志表单数据
       */
      logOptionData: {
        logRetentionDays: 5, // 日志保留天数
        logBackupCycle: 5, // 日志备份周期
        logBackupRetentionDays: 5, // 日志备份保留天数
      },
      /**
       * 日志表单规则
       */
      logOptionRules: {
        logRetentionDays: [
          { required: true, message: '请输入日志保留天数', trigger: 'blur' },
          { type: 'number', min: 1, max: 365, message: '日志保留天数范围为1-365天', trigger: 'blur' }
        ],
        logBackupCycle: [
          { required: true, message: '请输入日志备份周期', trigger: 'blur' },
          { type: 'number', min: 1, max: 365, message: '日志备份周期范围为1-365天', trigger: 'blur' }
        ],
        logBackupRetentionDays: [
          { required: true, message: '请输入日志备份保留天数', trigger: 'blur' },
          { type: 'number', min: 1, max: 365, message: '日志备份保留天数范围为1-365天', trigger: 'blur' }
        ],
      },
      /**
       * 用户表单数据
       */
      userOptionData: {
        auth_failed_max_times: 10, // 最大鉴权失败次数
        auth_failed_try_later: 300, // 鉴权失败等待时间
        enable_complex_password: false // 启用复杂密码
      },
      /**
       * 用户表单规则
       */
      userOptionRules: {
        auth_failed_max_times: [
          { required: true, message: '请输入最大鉴权失败次数', trigger: 'blur' },
          { type: 'number', min: 0, max: 100, message: this.$t('systemSetting.authFailMax'), trigger: 'blur' }
        ],
        auth_failed_try_later: [
          { required: true, message: '请输入鉴权失败等待时间，单位秒', trigger: 'blur' },
          { type: 'number', min: 0, max: 1_000_000, message: this.$t('systemSetting.authFailWait'), trigger: 'blur' }
        ]
      },

      /**
       * 终端表单数据
       */
      clientOptionData: {
        desktop_client_console_password: '', // 终端高级设置密码
        max_binding_client_num: '', // 最大绑定终端数量
        faq_url: '', //  faq地址
        log_extraction_interval: 180, //日志提取的间隔时间
        log_extraction_times: 5, //日志提取的次数
      },
      /**
       * 终端表单规则
       */
      clientOptionRules: {
        desktop_client_console_password: [
          { required: true, message: '请输入终端高级设置密码', trigger: 'blur' },
        ],
        faq_url: [
          { required: true, message: '请输入FAQ地址', trigger: 'blur' },
          { type: 'string', min: 1, max: 200, message: this.$t('systemSetting.faq_url_tips'), trigger: 'blur' },
          { validator: validateUrl, trigger: 'blur' }
        ],
        max_binding_client_num: [
          { required: true, message: '最大绑定终端数量', trigger: 'blur' },
          { type: 'number', min: 1, max: 5, message: this.$t('systemSetting.max_bingding_client_num_tips'), trigger: 'blur' },
        ],
        log_extraction_interval: [
          { required: true, message: '日志提取的间隔时间', trigger: 'blur' },
          { type: 'number', min: 0, max: 1000, message: this.$t('systemSetting.log_extraction_minutes_tips'), trigger: 'blur' }
        ],
        log_extraction_times: [
          { required: true, message: '日志提取的次数', trigger: 'blur' },
          { type: 'number', min: 0, max: 24, message: this.$t('systemSetting.log_extraction_times_tips'), trigger: 'blur' }
        ]
      },
      /**
       * 系统表单数据
       */
      systemOptionData: {
        dbBackupPosition: "", // 数据库备份存储位置
        dbBackupRetentionCount: 3, // 保留数据库备份数
        ntp_server_ip_addr: "" // NTP时钟服务器地址
      },
      /**
       * 系统表单规则
       */
      systemOptionRules: {
        dbBackupPosition: [
          { required: true, message: '请输入数据库备份存储位置', trigger: 'blur' }
        ],
        dbBackupRetentionCount: [
          { required: true, message: '请输入保留数据库备份数', trigger: 'blur' },
          { type: 'number', min: 0, max: 100, message: '保留数据库备份数范围为0-100', trigger: 'blur' }
        ],
        ntp_server_ip_addr: [
          { required: true, message: '请输入NTP时钟服务器地址', trigger: 'blur' },
          { validator: (rule: any, value: any, callback: any) => {
            if (value && value.length > 255) {
              return callback(new Error((this as any).$t("systemSettings.ntpLengthError")));
            }
            if (isValidNetAddress(value)) {
              return callback();
            } else {
              return callback(new Error((this as any).$t('systemSettings.ntpFormetError')));
            }
          }, trigger: 'blur' }
        ]
      },
      // 订单表单数据
      orinusOptionData: {
        desktop_order_check_polling_interval: 30, // 桌面订单检测间隔
        desktop_order_handling_timeout: 1800, // 桌面订单整体处理超时时间
        desktop_order_handling_dead_timeout: 120, // 桌面订单单步处理超时时间
        horizon_resource_count_polling_interval: 300, //资源池内存查询周期
      },

      // 订单规则
      orinusOptionRules: {
        desktop_order_check_polling_interval: [
          { required: true, message: '请输入桌面订单检测间隔', trigger: 'blur' },
          { type: 'number', min: 1, max: 1_000_000, message: this.$t('systemSetting.check_pooling_interval'), trigger: 'blur' }
        ],
        desktop_order_handling_timeout: [
          { required: true, message: '请输入桌面订单整体处理超时时间', trigger: 'blur' },
          { type: 'number', min: 1, max: 14400, message: this.$t('systemSetting.handling_timeout'), trigger: 'blur' }
        ],
        desktop_order_handling_dead_timeout: [
          { required: true, message: '请输入桌面订单单步处理超时时间', trigger: 'blur' },
          { type: 'number', min: 1, max: 14400, message: this.$t('systemSetting.handling_dead_timeout'), trigger: 'blur' }
        ],
        horizon_resource_count_polling_interval: [
          { required: true, message: '请输入资源池内存查询周期，单位秒', trigger: 'blur' },
          { type: 'number', min: 300, max: 3600, message: this.$t("systemSetting.ResourceMemoryQuery"), trigger: 'blur' }
        ],
      },
      /**
       * 工作区表单数据
       */
      workSpaceData: {
        horizonDaaSWorkspaceDefault: 2000, // HorizonDaaS工作区桌面最大数量限制
        horizonEdgrWorkspaceDefault: 200,
        // horizonEdgeSubstWorkspace: 5, // HorizonEdgeSubst工作区桌面最大数量限制
      },
      /**
       * 工作区表单规则
       */
      workSpaceRules: {
        horizonDaaSWorkspaceDefault: [
          { required: true, message: (this as any).$t('workspace.horizonDaaSWorkspaceDefaultError01'), trigger: 'blur' },
          { type: 'number', min: 1, max: 2000, message: (this as any).$t('workspace.horizonDaaSWorkspaceDefaultError02'), trigger: 'blur' }
        ],
        horizonEdgrWorkspaceDefault: [
          { required: true, message: (this as any).$t('workspace.horizonEdgrWorkspaceDefaultError01'), trigger: 'blur' },
          { type: 'number', min: 1, max: 200, message: (this as any).$t('workspace.horizonEdgrWorkspaceDefaultError02'), trigger: 'blur' }
        ],
        horizonEdgeSubstWorkspace: [
          { required: true, message: '请输入HorizonEdgeSubst工作区桌面最大限制数', trigger: 'blur' },
          { type: 'number', min: 1, max: 200, message: 'HorizonEdgeSubst工作区桌面最大限制小于等于200', trigger: 'blur' }
        ],
      },
    }
  },
  mounted() {
    (this as any).getData();
    (this as any).getSystemAdminList();
  },
  methods: {
    delContext(str: any){
      if(str.length > 50) {
        return str.substr(0,50) + '...'
      }
      return str;
    },
    // 密码变*
    getPasswordHidden(password: any) {
      let str = '';
      for (let i = 0; i < password.length; i ++) {
        str += '*'
      }
      return str;
    },
    getSystemAdminList() {
      (this as any).$tunnyApi.apiGetSystemManagerList().then((res: any) => {
        (this as any).systemAdminList = res;
        // console.log(res,'GetList');
      });
    },
    getResourcePool() {
      (this as any).$pandaApi.apiGetSystemSettings().then((res: any) => {
        // console.log(res, 'GetResourcePool');
      }).finally(() => {
        (this as any).loading = false;
      });
    },
    getData(options: {
      loadResourcePoolData: boolean;
      loadDesktopData: boolean;
      loadSessionData: boolean;
      loadAlertData: boolean;
      loadLogData: boolean;
      loadUserData: boolean;
      loadClientData: boolean;
      loadSystemData: boolean;
      loadOrinusData: boolean;
      loadWorkSpaceData: boolean;
    } = {
      loadResourcePoolData: true,
      loadDesktopData: true,
      loadSessionData: true,
      loadAlertData: true,
      loadLogData: true,
      loadUserData: true,
      loadClientData: true,
      loadSystemData: true,
      loadOrinusData: true,
      loadWorkSpaceData: true,
    }) {

      options.loadResourcePoolData ? (this as any).resourcePoolLoading = true : "";
      options.loadDesktopData ? (this as any).desktopLoading = true : "";
      options.loadSessionData ? (this as any).sessionLoading = true : "";
      options.loadAlertData ? (this as any).alertLoading = true : "";
      options.loadLogData ? (this as any).logLoading = true : "";
      options.loadUserData ? (this as any).userLoading = true : "";
      options.loadSystemData ? (this as any).systemLoading = true : "";
      options.loadClientData ? (this as any).clientLoading = true : "";
      options.loadOrinusData ? (this as any).orinusLoading = true : "";
      options.loadWorkSpaceData ? (this as any).workSpaceLoading = true : "";
      
      (this as any).$pandaApi.apiGetSystemSettings().then((res: any) => {
        (this as any).$tunnyApi.apiGetUserSettings().then((result: any) => {
          options.loadUserData ? (this as any).userOptionData = {
            auth_failed_max_times: result.auth_failed_max_times, // 最大鉴权失败次数
            auth_failed_try_later: result.auth_failed_try_later, // 鉴权失败等待时间
            enable_complex_password: result.enable_complex_password // 启用复杂密码
          } : "";
        });

        options.loadResourcePoolData ? (this as any).resourcePoolOptionData = {
          // resource_polling_interval: res.resource_polling_interval, // 普通版租户自动同步周期
          sync_resource_polling_interval: res.sync_resource_polling_interval, // 资源自动同步周期
          adAutoSyncCycle: res.adAutoSyncCycle, // AD域控制器自动同步周期
          global_desktop_exceptions_notice_mobiles: res.global_desktop_exceptions_notice_mobiles.join(','),
          global_desktop_exceptions_notice_mails: res.global_desktop_exceptions_notice_mails.join(',')
        } : "";

        options.loadDesktopData ? (this as any).desktopOptionData = {
          timeout_of_desktop_status: res.timeout_of_desktop_status, // 桌面状态丢失超时（单位：秒）
          horizonDesktopStatusCheckTimeOut: res.horizonDesktopStatusCheckTimeOut, // Horizon桌面状态检测超时
          daasDesktopStatusPollingInterval: res.daasDesktopStatusPollingInterval, // Daas桌面状态轮询间隔
          daasDesktopStatusCheckTimeOut: res.daasDesktopStatusCheckTimeOut // Daas桌面状态检测超时
        } : "";

        options.loadSessionData ? (this as any).sessionOptionData = {
          desktop_session_polling_interval: res.desktop_session_polling_interval, // 桌面会话检测间隔
          desktop_heartbeat_interval: res.desktop_heartbeat_interval, // 桌面会话上报间隔
          desktop_session_timeout: res.desktop_session_timeout // 桌面会话丢失超时
        } : "";

        options.loadAlertData ? (this as any).alertOptionData = {
          manageServerCheckInterval: res.manageServerCheckInterval, // 管理服务器检测间隔
          manageServerCheckTimeout: res.manageServerCheckTimeout, // 管理服务器检测超时
          ADCheckInterval: res.ADCheckInterval, // AD域检测间隔
          ADCheckTimeout: res.ADCheckTimeout, // AD域检测超时
          desktopGatewayCheckInterval: res.desktopGatewayCheckInterval, // 桌面网关检测间隔
          desktopGatewayCheckTimeout: res.desktopGatewayCheckTimeout, // 桌面网关检测超时
          desktopNetworkCheckInterval: res.desktopNetworkCheckInterval, // 桌面网络检测间隔
          desktopNetworkCheckTimeout: res.desktopNetworkCheckTimeout, // 桌面网络检测超时
          alertManagerList: res.alertManagerList // 接受告警的系统管理员列表
        } : "";

        options.loadClientData ? (this as any).clientOptionData.desktop_client_console_password = decodeToken(res.desktop_client_console_password.replace('\n','')): ''; // 终端高级设置密码
        options.loadClientData ? (this as any).clientOptionData.max_binding_client_num = res.max_binding_client_num : "";

        options.loadSystemData ? (this as any).systemOptionData = {
          dbBackupPosition: res.dbBackupPosition, // 数据库备份存储位置
          dbBackupRetentionCount: res.dbBackupRetentionCount, // 保留数据库备份数
          ntp_server_ip_addr: res.ntp_server_ip_addr // NTP时钟服务器地址
        } : "";
        options.loadWorkSpaceData ? (this as any).workSpaceData = {
          horizonEdgrWorkspaceDefault: res.desktop_quota_of_horizon_edge,
          horizonDaaSWorkspaceDefault: res.desktop_quota_of_horizon_daas
        } : "";
      }).finally(() => {
        options.loadResourcePoolData ? (this as any).resourcePoolLoading = false : "";
        options.loadDesktopData ? (this as any).desktopLoading = false : "";
        options.loadSessionData ? (this as any).sessionLoading = false : "";
        options.loadAlertData ? (this as any).alertLoading = false : "";
        options.loadUserData ? (this as any).userLoading = false : "";
        options.loadSystemData ? (this as any).systemLoading = false : "";
        options.loadWorkSpaceData ? (this as any).workSpaceLoading = false : "";
      });

      (this as any).$pandaApi.apiGetSettings().then((res: any) => {
        options.loadClientData ? (this as any).clientOptionData.faq_url = res.faq_url : '' ;// faq
        options.loadClientData ? (this as any).clientOptionData. log_extraction_interval= res.log_extract_interval : '' ;
        options.loadClientData ? (this as any).clientOptionData. log_extraction_times= res.log_extract_max_times : '' ;
      }).finally(()=>{
        options.loadClientData ? (this as any).clientLoading = false : "";
      });

      (this as any).$eagleApi.apiGetLogCycle().then((res: any) => {
        options.loadLogData ? (this as any).logOptionData.logBackupCycle = res.log_backup_cycle : '' ;
        options.loadLogData ? (this as any).logOptionData.logBackupRetentionDays= res.log_backup_reverse_days : '' ;
        options.loadLogData ? (this as any).logOptionData.logRetentionDays= res.log_reverse_days : '' ;
      }).finally(()=>{
        options.loadLogData ? (this as any).logLoading = false : "";
      });

      (this as any).$orinusApi.apiGetOrinusSettings().then((res: any) => {
        options.loadOrinusData ? (this as any).orinusOptionData.desktop_order_check_polling_interval = res.desktop_order_check_polling_interval : '';
        options.loadOrinusData ? (this as any).orinusOptionData.desktop_order_handling_timeout = res.desktop_order_handling_timeout : '';
        options.loadOrinusData ? (this as any).orinusOptionData.desktop_order_handling_dead_timeout = res.desktop_order_handling_dead_timeout : ''
        options.loadOrinusData ? (this as any).orinusOptionData.horizon_resource_count_polling_interval = res.horizon_resource_count_polling_interval : '' //资源池内存查询周期

      }).finally(()=>{
        options.loadOrinusData ? (this as any).orinusLoading = false : "";
      });
    },
    async save(options: {
      loadResourcePoolData: boolean;
      loadDesktopData: boolean;
      loadSessionData: boolean;
      loadAlertData: boolean;
      loadLogData: boolean;
      loadUserData: boolean;
      loadClientData: boolean;
      loadSystemData: boolean;
      loadOrinusData: boolean;
      loadWorkSpaceData: boolean;
    } = {
      loadResourcePoolData: true,
      loadDesktopData: true,
      loadSessionData: true,
      loadAlertData: true,
      loadLogData: true,
      loadClientData: true,
      loadUserData: true,
      loadSystemData: true,
      loadOrinusData: true,
      loadWorkSpaceData: true,
    }) {
      const reqData = {};
      try {
        if (options.loadResourcePoolData) {
          await (this as any).checkFormByRef('resourcePoolOptionForm');
          (this as any).resourcePoolLoading = true;

          console.log((this as any).resourcePoolOptionData, 'resourcePoolOptionData');
          let resourcePoolOptionData: any = [];
          resourcePoolOptionData = deepClone((this as any).resourcePoolOptionData);
          resourcePoolOptionData.global_desktop_exceptions_notice_mobiles = encrypt('[' + (this as any).resourcePoolOptionData.global_desktop_exceptions_notice_mobiles + ']');
          resourcePoolOptionData.global_desktop_exceptions_notice_mails = encrypt(JSON.stringify((this as any).resourcePoolOptionData.global_desktop_exceptions_notice_mails.split(',')));
          Object.assign(reqData, resourcePoolOptionData);
        } if (options.loadDesktopData) {
          await (this as any).checkFormByRef('desktopOptionForm');
          (this as any).desktopLoading = true;
          Object.assign(reqData, (this as any).desktopOptionData);
        } if (options.loadSessionData) {
          await (this as any).checkFormByRef('sessionOptionForm');
          (this as any).sessionLoading = true;
          Object.assign(reqData, (this as any).sessionOptionData);
        } if (options.loadAlertData) {
          await (this as any).checkFormByRef('alertOptionForm');
          (this as any).alertLoading = true;
          Object.assign(reqData, (this as any).alertOptionData);
        } if (options.loadLogData) {
          await (this as any).checkFormByRef('logOptionForm');
          (this as any).logLoading = true;
          Object.assign(reqData, (this as any).logOptionData);
          (this as any).$eagleApi.apiPatchLogCycle({
            settings: {
              log_backup_cycle: (reqData as any).logBackupCycle, //日志备份周期
              log_backup_reverse_days: (reqData as any).logBackupRetentionDays, //日志备份保留天数
              log_reverse_days: (reqData as any).logRetentionDays, //日志保留天数
            }
          })
        } if (options.loadUserData) {//用户部分中的编辑保存时触发
          await (this as any).checkFormByRef('userOptionForm');
          (this as any).userLoading = true;
          Object.assign(reqData, (this as any).userOptionData);
        } if (options.loadSystemData) {
          await (this as any).checkFormByRef('systemOptionForm');
          (this as any).systemLoading = true;
          Object.assign(reqData, (this as any).systemOptionData);
        } if (options.loadClientData) {
          await (this as any).checkFormByRef('clientOptionForm');
          (this as any).clientLoading = true;
          (this as any).clientOptionData.desktop_client_console_password = encrypt((this as any).clientOptionData.desktop_client_console_password);
          await Object.assign(reqData, (this as any).clientOptionData);
          (this as any).$pandaApi.apiPatchSettings({
            settings: {
              faq_url: (reqData as any).faq_url,
              max_binding_client_num: (reqData as any).max_binding_client_num,
              log_extract_interval: (reqData as any).log_extraction_interval, //日志提取的间隔时间
              log_extract_max_times: (reqData as any).log_extraction_times, //日志提取的次数
            }
          })
        } if (options.loadOrinusData) {
          await (this as any).checkFormByRef('orinusOptionForm');
          (this as any).OrinusLoading = true;
          Object.assign(reqData, (this as any).orinusOptionData);
          (this as any).$orinusApi.apiPatchOrinusSettings({
            settings: this.orinusOptionData,
          });
        } if(options.loadWorkSpaceData) {
          await (this as any).checkFormByRef('workSpaceOptionForm');
          (this as any).workSpaceLoading = true;
          Object.assign(reqData, {
            desktop_quota_of_horizon_edge: (this as any).workSpaceData.horizonEdgrWorkspaceDefault,
            desktop_quota_of_horizon_daas: (this as any).workSpaceData.horizonDaaSWorkspaceDefault
          });
          (this as any).$pandaApi.apiPatchSettings({
            settings: {
              desktop_quota_of_horizon_edge: (reqData as any).horizonEdgrWorkspaceDefault,
              desktop_quota_of_horizon_daas: (reqData as any).horizonDaaSWorkspaceDefault
            }
          })
        }
        this.$message.success((this as any).$t('common.changeSuccess'));
      } catch (error) {
        console.log(error, 'error')
        this.$message.warning((this as any).$t('common.changeError'));
        return;
      }
      (this as any).loading = true;
      if ((reqData as any).auth_failed_max_times || (reqData as any).auth_failed_try_later) {
        (this as any).$tunnyApi.apiPutUserSettings(reqData).then(() => {
          options.loadResourcePoolData ? (this as any).resourcePoolOptionEditable = false : "";
          options.loadDesktopData ? (this as any).desktopOptionEditable = false : "";
          options.loadSessionData ? (this as any).sessionOptionEditable = false : "";
          options.loadAlertData ? (this as any).alertOptionEditable = false : "";
          options.loadLogData ? (this as any).logOptionEditable = false : "";
          options.loadUserData ? (this as any).userOptionEditable = false : "";
          options.loadClientData ? (this as any).clientOptionEditable = false : "";
          options.loadSystemData ? (this as any).systemOptionEditable = false : "";
          options.loadOrinusData ? (this as any).orinusOptionEditable = false : "";
          options.loadWorkSpaceData ? (this as any).workSpaceOptionEditable = false : "";
          (this as any).loading = false;
        }).finally((res: any) => {
          options.loadResourcePoolData ? (this as any).resourcePoolLoading = false : "";
          options.loadDesktopData ? (this as any).desktopLoading = false : "";
          options.loadSessionData ? (this as any).sessionLoading = false : "";
          options.loadAlertData ? (this as any).alertLoading = false : "";
          options.loadLogData ? (this as any).logLoading = false : "";
          options.loadUserData ? (this as any).userLoading = false : "";
          options.loadClientData ? (this as any).clientLoading = false : "";
          options.loadSystemData ? (this as any).systemLoading = false : "";
          options.loadOrinusData ? (this as any).orinusLoading = false : "";
          options.loadWorkSpaceData ? (this as any).workSpaceLoading = false : "";
          (this as any).loading = false;
        });
        (this as any).$systemTunnyApi.apiPutUserSettings({
          auth_failed_max_times:this.userOptionData.auth_failed_max_times,
          auth_failed_try_later:this.userOptionData.auth_failed_try_later,
          enable_complex_password:this.userOptionData.enable_complex_password
        }).then(() => {
          options.loadResourcePoolData ? (this as any).resourcePoolOptionEditable = false : "";
          options.loadDesktopData ? (this as any).desktopOptionEditable = false : "";
          options.loadSessionData ? (this as any).sessionOptionEditable = false : "";
          options.loadAlertData ? (this as any).alertOptionEditable = false : "";
          options.loadLogData ? (this as any).logOptionEditable = false : "";
          options.loadUserData ? (this as any).userOptionEditable = false : "";
          options.loadClientData ? (this as any).clientOptionEditable = false : "";
          options.loadSystemData ? (this as any).systemOptionEditable = false : "";
          options.loadOrinusData ? (this as any).orinusOptionEditable = false : "";
          options.loadWorkSpaceData ? (this as any).workSpaceOptionEditable = false : "";
          (this as any).loading = false;
        }).finally((res: any) => {
          options.loadResourcePoolData ? (this as any).resourcePoolLoading = false : "";
          options.loadDesktopData ? (this as any).desktopLoading = false : "";
          options.loadSessionData ? (this as any).sessionLoading = false : "";
          options.loadAlertData ? (this as any).alertLoading = false : "";
          options.loadLogData ? (this as any).logLoading = false : "";
          options.loadUserData ? (this as any).userLoading = false : "";
          options.loadClientData ? (this as any).clientLoading = false : "";
          options.loadSystemData ? (this as any).systemLoading = false : "";
          options.loadOrinusData ? (this as any).orinusLoading = false : "";
          options.loadWorkSpaceData ? (this as any).workSpaceLoading = false : "";
          (this as any).loading = false;
        });
      } else {
        (this as any).$pandaApi.apiSaveSystemSettings(reqData).then(() => {
          options.loadResourcePoolData ? (this as any).resourcePoolOptionEditable = false : "";
          options.loadDesktopData ? (this as any).desktopOptionEditable = false : "";
          options.loadSessionData ? (this as any).sessionOptionEditable = false : "";
          options.loadAlertData ? (this as any).alertOptionEditable = false : "";
          options.loadLogData ? (this as any).logOptionEditable = false : "";
          options.loadUserData ? (this as any).userOptionEditable = false : "";
          options.loadClientData ? (this as any).clientOptionEditable = false : "";
          options.loadSystemData ? (this as any).systemOptionEditable = false : "";
          options.loadOrinusData ? (this as any).orinusOptionEditable = false : "";
          options.loadWorkSpaceData ? (this as any).workSpaceOptionEditable = false : "";
          (this as any).loading = false;
        }).finally((res: any) => {
          options.loadResourcePoolData ? (this as any).resourcePoolLoading = false : "";
          options.loadDesktopData ? (this as any).desktopLoading = false : "";
          options.loadSessionData ? (this as any).sessionLoading = false : "";
          options.loadAlertData ? (this as any).alertLoading = false : "";
          options.loadLogData ? (this as any).logLoading = false : "";
          options.loadUserData ? (this as any).userLoading = false : "";
          options.loadClientData ? (this as any).clientLoading = false : "";
          options.loadSystemData ? (this as any).systemLoading = false : "";
          options.loadOrinusData ? (this as any).orinusLoading = false : "";
          options.loadWorkSpaceData ? (this as any).workSpaceLoading = false : "";
          (this as any).loading = false;
        });
      }
      setTimeout(() => {
        (this as any).loading = false;
        (this as any).getData(options);
      }, 1000);
    },
  
    cancel(options: {
      loadResourcePoolData: boolean;
      loadDesktopData: boolean;
      loadSessionData: boolean;
      loadAlertData: boolean;
      loadLogData: boolean;
      loadUserData: boolean;
      loadClientData: boolean;
      loadSystemData: boolean;
      loadOrinusData: boolean;
      loadWorkSpaceData: boolean;
    } = {
      loadResourcePoolData: true,
      loadDesktopData: true,
      loadSessionData: true,
      loadAlertData: true,
      loadLogData: true,
      loadUserData: true,
      loadClientData: true,
      loadSystemData: true,
      loadOrinusData: true,
      loadWorkSpaceData: true,
    }) {
      (this as any).getData(options);
      options.loadResourcePoolData ? (this as any).resourcePoolOptionEditable = false : "";
      options.loadDesktopData ? (this as any).desktopOptionEditable = false : "";
      options.loadSessionData ? (this as any).sessionOptionEditable = false : "";
      options.loadAlertData ? (this as any).alertOptionEditable = false : "";
      options.loadLogData ? (this as any).logOptionEditable = false : "";
      options.loadUserData ? (this as any).userOptionEditable = false : "";
      options.loadClientData ? (this as any).clientOptionEditable = false : "";
      options.loadSystemData ? (this as any).systemOptionEditable = false : "";
      options.loadOrinusData ? (this as any).orinusOptionEditable = false : "";
      options.loadWorkSpaceData ? (this as any).workSpaceOptionEditable = false : "";

      options.loadResourcePoolData ? (this as any).$refs['resourcePoolOptionForm'].clearValidate() : "";
      options.loadDesktopData ? (this as any).$refs['desktopOptionForm'].clearValidate() : "";
      options.loadSessionData ? (this as any).$refs['sessionOptionForm'].clearValidate() : "";
      options.loadAlertData ? (this as any).$refs['alertOptionForm'].clearValidate() : "";
      options.loadLogData ? (this as any).$refs['logOptionForm'].clearValidate() : "";
      options.loadUserData ? (this as any).$refs['userOptionForm'].clearValidate() : "";
      options.loadClientData ? (this as any).$refs['clientOptionForm'].clearValidate() : "";
      options.loadSystemData ? (this as any).$refs['systemOptionForm'].clearValidate() : "";
      options.loadOrinusData ? (this as any).$refs['orinusOptionForm'].clearValidate() : "";
      options.loadWorkSpaceData ? (this as any).$refs['workSpaceOptionForm'].clearValidate() : "";
    },
    editAll() {
      (this as any).resourcePoolOptionEditable = true;
      (this as any).desktopOptionEditable = true;
      (this as any).sessionOptionEditable = true;
      (this as any).alertOptionEditable = true;
      (this as any).logOptionEditable = true;
      (this as any).userOptionEditable = true;
      (this as any).clientOptionEditable = true;
      (this as any).systemOptionEditable = true;
      (this as any).orinusOptionEditable = true;
      (this as any).workSpaceOptionEditable = true;
    },
    cancelAll() {
      (this as any).resourcePoolOptionEditable = false;
      (this as any).desktopOptionEditable = false;
      (this as any).sessionOptionEditable = false;
      (this as any).alertOptionEditable = false;
      (this as any).logOptionEditable = false;
      (this as any).userOptionEditable = false;
      (this as any).clientOptionEditable = false;
      (this as any).systemOptionEditable = false;
      (this as any).orinusOptionEditable = false;
      (this as any).workSpaceOptionEditable = false;
    },
    checkFormByRef(formName: any) {
      return new Promise((resolve, reject) => {
        (this as any).$refs[formName].validate((valid: any, something: any) => {
          if (valid) {
            resolve(valid);
          } else {
            reject(something);
          }
        });
      });
    },
 async saveAll() {
      try {
        await (this as any).checkFormByRef('resourcePoolOptionForm');
        await (this as any).checkFormByRef('desktopOptionForm');
        await (this as any).checkFormByRef('sessionOptionForm');
        await (this as any).checkFormByRef('alertOptionForm');
        await (this as any).checkFormByRef('logOptionForm');
        await (this as any).checkFormByRef('userOptionForm');
        await (this as any).checkFormByRef('clientOptionForm');
        await (this as any).checkFormByRef('systemOptionForm');
        await (this as any).checkFormByRef('orinusOptionForm');
        await (this as any).checkFormByRef('workSpaceOptionForm');
        
        (this as any).loading = true;
        setTimeout(() => {
          (this as any).loading = false;
          (this as any).cancelAll();
        }, 1000);
        
      } catch (error) {
        for (const item in error) {
          error[item].forEach((i: any) => {
            this.messagePromise = this.messagePromise.then((res: any) => {
              (this as any).$message.warning(i.message);
            })
          });
        }
        console.log(error);
      }
    }
  }
})
</script>
<style lang="scss" scoped>
.page-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #EFF1F4;

  .page-header {
    height: 60px;
    background-color: #FFFFFF;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #D9D9D9;

    .page-tile {
      color: #031129;
      font-size: 16px;
      margin-left: 20px;

      .iconzhongyiicon_gaojing {
        margin-left: 5px;
      }
    }
  }

  .page-content {
    height: calc(100vh - 110px);
    overflow: hidden;
    flex-grow: 1;

    .content-wrapper {
      padding: 15px;
    }
  }
}

.table-left-options {
  display: flex;
}

.table-right-options {
  display: flex;

  .setting-button {
    margin-right: 10px;
  }
}

.delete-warning-icon {
  color: #FF931D;
  font-size: 20px;
  margin-right: 10px;

  &::before {
    font-size: 20px;
  }
}

.action-wrapper {
  margin-bottom: 15px;
  display: flex;
}

.option-container {
  width: 70%;
  display: flex;
  margin: 0px;
  border-top: 1px solid #D9D9D9;

  ::v-deep .el-form-item__label {
    font-size: 14px;
    font-weight: unset;
    text-align: left;
    width: 315px;
    flex-shrink: 0;
    padding: 8px 12px;
    background-color: #F9F9F9;
  }

  ::v-deep .el-form-item__content {
    padding-left: 15px;
    flex-grow: 1;
    display: flex;
    justify-content: left;
    align-items: center;

    span {
      width: 320px;
      display: block;
    }

    .el-input, .el-select {
      width: 40%;
      flex-shrink: 0;
    }

    .el-form-item__error {
      margin-left: 5px;
      flex-grow: 1;
      position: unset;
    }
  }
}
.option-container {
  ::v-deep .el-input__icon.el-icon-view.el-input__clear {
    position: absolute;
    right: 0;
  }
}
.option-container:last-child {
  border-bottom: 1px solid #D9D9D9;
}
</style>
